package com.example.a10928.weifriend.ui.task_center

import android.annotation.SuppressLint
import android.databinding.DataBindingUtil
import android.databinding.ViewDataBinding
import android.os.Bundle
import android.os.Handler
import android.os.Parcel
import android.os.Parcelable
import android.support.v4.app.Fragment
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.a10928.weifriend.App.app
import com.example.a10928.weifriend.R
import com.example.a10928.weifriend.adapter.MemberTaskAdapter
import com.example.a10928.weifriend.adapter.MyViewPageAdapter
import com.example.a10928.weifriend.databinding.ActivityTaskRecordBinding
import com.example.a10928.weifriend.databinding.FragmentTaskRecordBinding
import com.example.a10928.weifriend.http.api.VariableName
import com.example.a10928.weifriend.ui.BaseFragment
import com.example.a10928.weifriend.ui.DatabindingBaseActivity
import com.example.a10928.weifriend.util.RxUtil
import com.zhy.http.okhttp.OkHttpUtils.post
import me.leefeng.promptlibrary.PromptDialog


class TaskRecordActivity : DatabindingBaseActivity() {

    var dialog:PromptDialog?=null

    public var data:String=""
    private val titles: ArrayList<String> = arrayListOf("待提交", "待审核", "已完成")
    override fun bindingInitData() {


    }

    override fun bindingInitView(viewDataBinding: ViewDataBinding?) {
        data=intent.getStringExtra(VariableName.DATA)
        var mBinding = viewDataBinding as ActivityTaskRecordBinding
        setTitleText(ThemeEnum.Back_Default,"任务记录")
        for (i in 0..2) {
            val newTab = mBinding.taskRecordTab.newTab()
            mBinding.taskRecordTab.addTab(newTab)
        }
        mBinding.taskRecordTab.setupWithViewPager(mBinding.taskRecordPage)
        mBinding.taskRecordTab.isTabIndicatorFullWidth=false
        var fragments: ArrayList<Fragment> = arrayListOf(TaskRecordFragment(0,data), TaskRecordFragment(1,data), TaskRecordFragment(2,data))
        mBinding.taskRecordPage.adapter = MyViewPageAdapter(supportFragmentManager, titles, fragments)
        mBinding.taskRecordTab.setTabsFromPagerAdapter( mBinding.taskRecordPage.adapter)
//        mBinding.taskRecordTab.isTabIndicatorFullWidth=false
        dialog= PromptDialog(this)

    }

    override fun bindingGetContentView(): Int {
        return R.layout.activity_task_record
    }


    fun openProgress(){
        dialog?.showLoading("加载中")
    }

    fun closeProgress(){
        dialog?.dismiss()
    }


}
